package com.mustafaiev.tair.cts.tapestry.components;

import org.apache.tapestry5.SelectModel;
import org.apache.tapestry5.annotations.Parameter;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.mustafaiev.tair.cts.facade.IPayerFacade;
import com.mustafaiev.tair.cts.factory.ICostTrackingSystemFacadeFactory;
import com.mustafaiev.tair.cts.tapestry.dto.PayerDTO;
import com.mustafaiev.tair.cts.tapestry.encoder.PayerSelectEncoder;
import com.mustafaiev.tair.cts.tapestry.select.PayerSelectModel;

public class PayerSelect {

	private SelectModel model;

	@Inject
	private ICostTrackingSystemFacadeFactory facadeFactory;

	@Persist
	private PayerSelectEncoder encoder;

	@Parameter(required = true)
	@Property
	private PayerDTO payerDto;

	@Parameter(required = false, value = "false")
	@Property
	private Boolean isDisabled;

	public PayerSelectEncoder getEncoder() {
		this.encoder = new PayerSelectEncoder(
				this.facadeFactory.getFacade(IPayerFacade.class));
		return this.encoder;
	}

	public void setEncoder(final PayerSelectEncoder encoder) {
		this.encoder = encoder;
	}

	public SelectModel getModel() {
		this.model = new PayerSelectModel(
				this.facadeFactory.getFacade(IPayerFacade.class));
		return this.model;
	}

	public void setModel(final SelectModel model) {
		this.model = model;
	}

}
